<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>投资记录</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript" src="./script/aui-tab.js" ></script>
    <link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
    <script type="text/javascript" src="./script/aui-slide.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/jquery-3.2.0.js"></script>
    <script type="text/javascript">
        function closeWin(){
            api.closeWin({
            });
        };
    </script>
</head>
<body>
   <!-- 头部 -->
   <header class="aui-bar aui-bar-nav licai-record-head" id='topbar'>
    <a class="aui-pull-left aui-btn" onclick="closeWin()">
        <span class="aui-iconfont aui-icon-left"></span>
    </a>
    <div class="aui-title">投资记录</div>
</header>
<div class="licai-record-t" id="head" style="height:5.5rem;">


<h3 id="num" style="margin-top: 20px"></h3>
    <p>购买人/购买时间<span class="aui-pull-right">购买金额/购买方式</span></p>
</div>

<div class="licai-record-d" id="downbar">
    立即购买
</div>

<style>
    /*body,html{height:100%;}*/
</style>
<!-- <div class="licai-record">
    <div id="list"></div>
</div> -->
</body>


<script type="text/javascript">
    apiready = function(){
        // var id = api.pageParam.id;
        // load_list(id);
var h = '';
        var deviceModel = api.deviceModel;
        if (deviceModel.indexOf('iPhone10') > -1) {

          $('#num').css('margin-top','44px');
          h = 54;

        } else {
          $('#num').css('margin-top','20px');
          h = 30;
        }

        load_count = api.pageParam.load_count;

        $("#num").html('已购买人次：'+load_count);
        $api.fixStatusBar($api.dom('#topbar'));
        var headerPos = $api.offset($api.dom('#topbar'));
        var header2 = $api.offset($api.dom('#head'));
        var footerPos = $api.offset($api.dom('#downbar'));

        api.openFrame({
            name: 'licai-record-frame',
            url: './licai-record-frame.html',
            rect: {
                x: 0,
                y: headerPos.h + header2.h - h,
                w: 'auto',
                h: api.winHeight - (headerPos.h + header2.h + footerPos.h)
            },
            pageParam: {
                id: api.pageParam.id,
                load_count:load_count,
            },

        });
    }

    // 加载列表
    function load_list(id) {

        api.showProgress({
            style: 'default',
            animationType: 'fade',
            title: '努力加载中...',
            text: '先喝杯茶...',
            modal: false
        });

        api.ajax({
            url: webAddress+'/index.php?ctl=app_deal&act=deal&id='+id,
            method: 'get',
        },function(ret, err){

            if (ret) {

                if (ret.status == 0) {
                    alert(ret.info);
                }else {
                    // alert( JSON.stringify( ret ) );
                    updateList(ret.load_list, ret.load_list.length);

                    api.hideProgress();
                }
            } else {
                alert( JSON.stringify( err ) );
                api.hideProgress();
            }
        });
    }

    // doT
    function updateList(data, num){

        var template = $api.byId('template');
        var dotFn = doT.template(template.innerHTML);
        var html = dotFn(data);
        var list = $api.byId('list');
        $api.html(list, html);

        $(".time").each(function(){
            // alert($(this).text());
            var tmp = getDate($(this).text());
            $(this).text(tmp);
        });

        $(".money").each(function(){
            // alert($(this).text());
            var tmp = outputmoney($(this).text());
            $(this).text(tmp+'元');
        });

        $(".name").each(function(){
            // alert($(this).text());
            var tmp = hidden_name($(this).text());
            $(this).text(tmp);
        });

        document.getElementById('num').innerHTML = '已购买人次：'+num;

    }




</script>
</html>
